/*
 * @Author: atony2099
 * @Date: 2019-02-14 12:08:23
 * @Last Modified by: atony2099
 * @Last Modified time: 2019-02-15 04:26:08
 */

'use strict';
module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const UserSchema = new Schema({
    __v: {
      type: Number,
      select: false,
    },
    loginname: {
      type: 'String',
      unique: true,
    },
    username: {
      type: 'String',
    },
    password: {
      type: 'String',
    },

    token: {
      type: 'String',
    },
    createAt: {
      type: 'String',
      default: new Date(),
    },

    updateAt: {
      type: 'String',
      default: new Date(),
    },

    lastSignDate: {
      type: Date,
    },

    goldCount: {
      type: Number,
      default: 0,
    },
    continusDay: {
      type: Number,
      default: 0,
    },
  });

  return mongoose.model('User', UserSchema);
};
